﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using mvLibrary;
using mvLibrary.Helpers;
using BlueFinity.mvNET.CoreObjects;
using mvLibrary.Helpers.Utils;

namespace fenk.Seguridad
{
    public partial class PermisosPorUsuario : BaseForm
    {
        public PermisosPorUsuario()
        {
            InitializeComponent();
            this.toolBox.Enabled = false;
        }

        private void btnConsultar_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.txtUser.Text))
            {

                var selectList = ProgramCaller.Instance.GetPermisosPorUsuarios(this.UniAccount, txtUser.Text);

                selectList.Next();
                var currentItem = selectList.ReadList();

                var permisos = currentItem.ExtractAsString(1);
                lvwPermisos.Items.Clear();

                foreach (var VARIABLE in FenkUtils.SplitMultivalueAttributes(permisos))
                {
                    this.lvwPermisos.Items.Add(VARIABLE.ToUpper());
                }
            }
        }
    }
}
